import { ActionSheet} from 'antd-mobile';




export const  showActionSheet = (BUTTONS,message,cb=()=>{}) => {

  // fix touch to scroll background page on iOS
    // const isIPhone = new RegExp('\\biPhone\\b|\\biPod\\b', 'i').test(window.navigator.userAgent);
    // let wrapProps;
    // if (isIPhone) {
    //   wrapProps = {
    //     onTouchStart: e => e.preventDefault(),
    //   };
    // }

    // const BUTTONS = ['Operation1', 'Operation2', 'Operation2', 'Delete', 'Cancel'];
    // BUTTONS.push("添加新卡")
    // BUTTONS.push("取消")
    BUTTONS[BUTTONS.length-1] !== "取消"  &&  BUTTONS.push("取消")
    ActionSheet.showActionSheetWithOptions({
      options: BUTTONS,
      cancelButtonIndex: BUTTONS.length - 1,
      // destructiveButtonIndex: BUTTONS.length - 2,
      // title: 'title',
      message,
      maskClosable: true,
      'data-seed': 'logId',
      // wrapProps,
    },
    (buttonIndex) => {
      buttonIndex !== BUTTONS.length - 1 &&  cb(BUTTONS[buttonIndex],buttonIndex)
    });
 }

